import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;


public class DarrellPodTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void constructorTest() {
		DarrellPod myPod = new DarrellPod();
		
		assertTrue(myPod.size() == 0);
	}
	
	@Test
	public void addSong() {
		DarrellPod myPod = new DarrellPod();
		
		Song firstSong = new Song("aa", "aa", 10);
		
		myPod.addSong(firstSong);
		assertTrue(myPod.size() == 1);
		
		Song currentSong =  myPod.getSong(0);
		assertTrue(currentSong == firstSong);		
	}
	
	@Test
	public void addTwoSongs() {
		DarrellPod myPod = new DarrellPod();
		
		Song firstSong = new Song("aa", "aa", 10);
		Song secondSong = new Song("bb", "bb", 20);
		
		myPod.addSong(firstSong);
		myPod.addSong(secondSong);
		assertTrue(myPod.size() == 2);
		
		Song currentSong =  myPod.getSong(0);
		assertTrue(currentSong == firstSong);	
		
		currentSong =  myPod.getSong(1);
		assertTrue(currentSong == secondSong);
	}
	
	@Test
	public void playSong() {
		DarrellPod myPod = new DarrellPod();
		
		Song firstSong = new Song("aa", "aa", 10);
		Song secondSong = new Song("bb", "bb", 20);
		
		myPod.addSong(firstSong);
		myPod.addSong(secondSong);
		
		Song current = myPod.getCurrentSong();			

		myPod.playNextSong();
		current = myPod.getCurrentSong();
		assertTrue(current == firstSong);	
	}
	
	@Test
	public void backToBeginning() {
	DarrellPod myPod = new DarrellPod();
		
		Song firstSong = new Song("aa", "aa", 10);
		Song secondSong = new Song("bb", "bb", 20);
		Song thirdSong = new Song("cc", "cc", 20);
		
		myPod.addSong(firstSong);
		myPod.addSong(secondSong);
		myPod.addSong(thirdSong);
		
		myPod.playNextSong();

		assertTrue(myPod.getCurrentSong() == firstSong);
		
		myPod.playNextSong();
		assertTrue(myPod.getCurrentSong() == secondSong);
		
		myPod.playNextSong();
		assertTrue(myPod.getCurrentSong() == thirdSong);

		myPod.playNextSong();
		assertTrue(myPod.getCurrentSong() == firstSong);

	}

}
